set(LIB_SUPPORT_TYPES SHARED STATIC)

function(ascendc_executable target_name)
    if(ARGN)
        set_source_files_properties(${ARGN} PROPERTIES LANGUAGE ASC)
        add_executable(${target_name} ${ARGN})
        set_target_properties(${target_name} PROPERTIES LINKER_LANGUAGE ASC)
    endif()
endfunction()

function(ascendc_library target_name target_type)
    if(NOT target_type IN_LIST LIB_SUPPORT_TYPES)
        message(FATAL_ERROR "target_type ${target_type} is unsupported, the support list is ${LIB_SUPPORT_TYPES}")
    endif()
    if(ARGN)
        set_source_files_properties(${ARGN} PROPERTIES LANGUAGE ASC)
        add_library(${target_name} ${target_type} ${ARGN})
    endif()
endfunction()

function(ascendc_compile_definitions target_name target_scope)
    if(ARGN)
        target_compile_definitions(${target_name} ${target_scope} ${ARGN})
    endif()
endfunction()

function(ascendc_compile_options target_name target_scope)
    if(ARGN)
        target_compile_options(${target_name} ${target_scope} ${ARGN})
    endif()
endfunction()

function(ascendc_include_directories target_name target_scope)
    if(ARGN)
        target_include_directories(${target_name} ${target_scope} ${ARGN})
    endif()
endfunction()

function(ascendc_link_libraries target_name target_scope)
    if(ARGN)
        target_link_libraries(${target_name} ${target_scope} ${ARGN})
    endif()
endfunction()

function(ascendc_link_directories target_name target_scope)
    if(ARGN)
        target_link_directories(${target_name} ${target_scope} ${ARGN})
    endif()
endfunction()

function(ascendc_link_options target_name target_scope)
    if(ARGN)
        target_link_options(${target_name} ${target_scope} ${ARGN})
    endif()
endfunction()